/*
 * @Author: your name
 * @Date: 2021-08-26 16:44:02
 * @LastEditTime: 2021-08-26 16:44:03
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \briup\5-javascript\day04\7-例子2.js
 */
//js:很少用函数的重载（相同的函数名称，不同的返回值类型，不同的参数个数）;弱数据类型语言
function add() {
    //验证数据是number
    //累加
    var sum = 0;
    for (var key in arguments) {
        var value = arguments[key];
        if (typeof value == 'number') {
            sum = sum + value; //sum +=value;
        }
    }
    return sum;
}
var s1 = add(0);
var s2 = add(100, 200, 300, 'abc');
var s3 = add(1, 2, 3);
console.log(s1, s2, s3);